import Text.Show.Functions

-- Work with Church amount

type Church a = ( a -> a ) -> ( a -> a )
 
church :: Integer -> Church Integer
church 0 = \y -> \x -> x
church n = \y -> \x -> y ( church ( n - 1 ) y x )
 
unchurch :: Church Integer -> Integer
unchurch n = n (\ x -> x + 1 ) 0
 
main :: IO ()
main = do let a = unchurch $ church 1
              b = church 1
              c = unchurch $ church 5
              d = church 5
          putStrLn ( show a )
          putStrLn ( show b )
          putStrLn ( show c )
          putStrLn ( show d )
